<?=form_open('companies/add');?>
<div id="maincolumn">
<h2>Add A Company</h2>
	<div class="contentpanel">
	<fieldset>
		<legend>Company Details</legend>
		
		<dl>
			<dt><label for="company_name" class="required">Company Name</label></dt>
			<dd><input type="text" name="company_name" id="company_name" value="" class="{required:true}" /></dd>
			<dt><label for="account_code">Account Code</label></dt>
			<dd><input type="text" name="account_code" id="account_code" value="" class="" /></dd>
			<dt><label for="website">Web Site</label></dt>
			<dd><input type="text" name="website" id="website" value="" class="" /></dd>
			<dt><label for="company_notes" class="">Notes</label></dt>
			<dd><textarea name="company_notes" id="company_notes"></textarea></dd>
		</dl>
	</fieldset>
	
	<fieldset>
		<legend>Address</legend>
		<p><input type="checkbox" class="checkbox" name="addaddress" id="addaddress" /> <label for="addaddress">Add an Address to this Company?</label></p>
		<dl id="address_form" style="display: none;">
			<dt><label for="address_title" class="required">Address Title</label></dt>
			<dd><input type="text" name="address_title" id="address_title" value="" class="{required: '#addaddress:checked'}" /></dd>
			<dt><label for="address1" class="required">Address</label></dt>
			<dd><input type="text" name="address1" id="address1" value="" class="{required: '#addaddress:checked'}" /></dd>
			<dt><label for="address1" class="">Address</label></dt>
			<dd><input type="text" name="address2" id="address2" value="" class="" /></dd>
			<dt><label for="city" class="required">City</label></dt>
			<dd><input type="text" name="city" id="city" value="" class="{required: '#addaddress:checked'}" /></dd>
			<dt><label for="postcode" class="required">Post Code</label></dt>
			<dd><input type="text" name="postcode" id="postcode" value="" class="{required: '#addaddress:checked'}" /></dd>
			<dt><label for="region" class="">Region</label></dt>
			<dd><input type="text" name="region" id="region" value="" class="" /></dd>
			<dt><label for="iso" class="required">Country</label></dt>
			<dd><select name="countryid" id="countryid">
				<?php foreach ($countries as $country):?>
					<option value="<?=$country->id;?>" <?php if ($country->id == 225):?>selected="selected"<?php endif;?>><?=$country->printable_name;?></option>
				<?php endforeach;?>
				</select>
				</dd>
			
			<dt><label for="phone1" class="required">Phone</label></dt>
			<dd><input type="text" name="phone1" id="phone1" value="" class="{required: '#addaddress:checked'}" /></dd>
			
			<dt><label for="phone2" class="">Phone (Alt.)</label></dt>
			<dd><input type="text" name="phone2" id="phone2" value="" class="" /></dd>
			
			<dt><label for="fax" class="">Fax</label></dt>
			<dd><input type="text" name="fax" id="fax" value="" class="" /></dd>
		</dl>
	</fieldset>
	
	<fieldset>
		<legend>Contact</legend>
		<p><input type="checkbox" class="checkbox" name="addcontact" id="addcontact" /> <label for="addcontact">Add a Contact to this Company?</label></p>
		<dl id="contact_form" style="display: none;">
			<dt><label for="contact_title" class="required">Position</label></dt>
			<dd><input type="text" name="contact_title" id="contact_title" value="" class="{required: '#addcontact:checked'}" /></dd>
			<dt><label for="firstname" class="required">Firstname</label></dt>
			<dd><input type="text" name="firstname" id="firstname" value="" class="{required: '#addcontact:checked'}" /></dd>
			<dt><label for="surname" class="required">Surname</label></dt>
			<dd><input type="text" name="surname" id="surname" value="" class="{required: '#addcontact:checked'}" /></dd>
			<dt><label for="ddi" class="">DDI</label></dt>
			<dd><input type="ddi" name="ddi" id="ddi" value="" class="" /></dd>
			<dt><label for="mobile" class="">Mobile</label></dt>
			<dd><input type="text" name="mobile" id="mobile" value="" class="" /></dd>
			<dt><label for="email1" class="required">Email 1</label></dt>
			<dd><input type="text" name="email1" id="email1" value="" class="{required: '#addcontact:checked'}" /></dd>
			<dt><label for="email2" class="">Email 2</label></dt>
			<dd><input type="text" name="email2" id="email2" value="" class="" /></dd>
			<dt><label for="contact_notes" class="required">Notes</label></dt>
			<dd><textarea name="contact_notes" id="contact_notes"></textarea></dd>
		</dl>
	</fieldset>
	<fieldset>
		<dl>
			<dt></dt><dd><input type="submit" name="submit" value="Submit" class="button" /></dd>
		</dl>
	</fieldset>
	</div>
</div>   
	  
<div id="sidecolumn">
	<h2>Company Options</h2>

	<dl>
		<dt><label for="industry">Industry</label></dt>
		<dd>

			<select name="industryid" id="industryid" <?php if (!$industries):?>style="display: none;"<?php endif;?> class="{required:true}" >
				<?php foreach($industries as $industry):?>
					<option value="<?=$industry->id;?>"><?=$industry->industryname;?></option>
				<?php endforeach;?>
			</select>
			<br />
			<a href="javascript: void(0);" id="industry_industryid_industryname" class="selectadd">Add New Industry</a>
			<div id="industry_industryid_industryname_container" style="display: none;">
				<input type="text" name="industry_industryid_industryname_field" id="industry_industryid_industryname_field" value="" /> <button name="industry_industryid_industryname_button" id="industry_industryid_industryname_button">Add</button>
			</div>

		</dd>
		<dt><label for="company_type">Company Type</label></dt>
		<dd><input type="radio" value="prospect" id="prospect" name="prospect_client" class="checkbox" <?php if ($company_type == 'prospects'):?>checked="checked"<?php endif;?> /> <label for="prospect">Prospect</label> <br />
			<input type="radio" value="client" id="client" name="prospect_client" class="checkbox" <?php if ($company_type == 'clients'):?>checked="checked"<?php endif;?> /> <label for="client">Client</label> <br />
			<input type="radio" value="client" id="neither" name="prospect_client" class="checkbox" <?php if ($company_type == '' || $company_type == 'suppliers'):?>checked="checked"<?php endif;?> /> <label for="neither">Neither</label></dd>
		<dt><label for="supplier">Set this company as a supplier?</label></dt>
		<dd><input type="checkbox" value="1" id="supplier" name="supplier" class="checkbox" <?php if ($company_type == 'suppliers'):?>checked="checked"<?php endif;?> /> <label for="supplier">Supplier</label> </dd>
	</dl>
</div>				       

<?=form_close();?>
